﻿using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Outpatient.Infrastructure.Migrations
{
    /// <inheritdoc />
    public partial class 收费 : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "Consumption_details",
                columns: table => new
                {
                    Consumption_detailsId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    Patient_registrationId = table.Column<int>(type: "int", nullable: false),
                    DrugName = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    UnitPrice = table.Column<decimal>(type: "decimal(10,2)", nullable: false),
                    Quantity = table.Column<int>(type: "int", nullable: false),
                    IsDelete = table.Column<bool>(type: "tinyint(1)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Consumption_details", x => x.Consumption_detailsId);
                    table.ForeignKey(
                        name: "FK_Consumption_details_Patient_registration_Patient_registratio~",
                        column: x => x.Patient_registrationId,
                        principalTable: "Patient_registration",
                        principalColumn: "Patient_registrationId",
                        onDelete: ReferentialAction.Cascade);
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateIndex(
                name: "IX_Consumption_details_Patient_registrationId",
                table: "Consumption_details",
                column: "Patient_registrationId");
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "Consumption_details");
        }
    }
}
